<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <link href="../css/export.css" rel="stylesheet" type="text/css" />
    <script src="../list_files/jquery.min.js"></script>
</head>

<body>
<!--导出-->
<div class="dczd-more">
    <div>
        <div class="dczd-m-nr">

            <div style="line-height: 36px">

                    <div class="dczd-t" style=""> </div>

                <div class="dczd-t">
                    数据源：
                    <a class="lw" href="javaScript:void(0)">论文</a>&nbsp &nbsp
                    <a class="zl" href="javaScript:void(0)">专利</a> &nbsp &nbsp
                    <a class="jg" href="javaScript:void(0)">机构</a>
                </div >

                <div class="dczd-t">
                    导出形式：<dd id="sh-dx" >
                    <div class="box">
                        <input type="radio"  id="radio-xb-1"  name="radio-lx" value="excel"  checked="checked"/>
                        <label for="radio-xb-1">excel</label>
                    </div>
                    <div class="box">
                        <input type="radio"    name="radio-lx" value="csv" />
                        <label for="radio-xb-2">csv</label>
                    </div>
                    <div class="box">
                        <input type="radio"   name="radio-lx" value="tsv" />
                        <label for="radio-xb-3">tsv</label>
                    </div>
                </dd>
                </div>

            </div>




            <ul class="exPaper">
                <li th:each="field : ${paper_field_map}"><input type="checkbox" name="dczd" th:value="${field.key}" /><label>[[${field.value}]]</label></li>
            </ul>

            <ul class="exPatent" style="display: none">
                <li th:each="field : ${patent_field_map}"><input type="checkbox" name="dczd" th:value="${field.key}" /><label>[[${field.value}]]</label></li>
            </ul>

            <ul class="exOrgn" style="display: none">
                <li th:each="field : ${company_field_map}"><input type="checkbox" name="dczd" th:value="${field.key}" /><label>[[${field.value}]]</label></li>
            </ul>

            <div class="dczd-an"><a onclick="dc();">导出</a></div>
        </div>

    </div>
</div>
<script>

    var obj = "paper";

    $(".lw").click(function () {
        obj = "paper";
        $(".exPaper").show();
        $(".exPatent").hide();
        $(".exOrgn").hide();
    })

    $(".zl").click(function () {
        obj = "patent";
        $(".exPatent").show();
        $(".exPaper").hide();
        $(".exOrgn").hide();
    })

    $(".jg").click(function () {
        obj = "company";
        $(".exOrgn").show();
        $(".exPaper").hide();
        $(".exPatent").hide();
    })

    function dc() {
            // 获取导出形式
       var type =  $("input:radio:checked").val();
       var fields = [];
       $("input:checkbox:checked").each(function () {
           fields.push($(this).val());
       });
       if(fields.length === 0){
           return;
       }

       var keyword = parent.window.keyword == null ? '':parent.window.keyword;

       location.href =  '/'+obj+'/export/'+type +'?columns='+fields.join(',')+'&keyword='+keyword;
    }

</script>

</body>
</html>